package com.heima.mapper;

import com.heima.pojo.Merchandise;
import com.heima.pojo.skuClass;
import org.apache.ibatis.annotations.Insert;
import org.apache.ibatis.annotations.Mapper;
import org.apache.ibatis.annotations.Param;
import org.apache.ibatis.annotations.Select;

import java.util.List;

@Mapper
public interface MerchandiseMapper {
    //查询商品

    List<Merchandise> selectBySku(Integer skuId);
    //查询商品分类
    @Select("select * from tb_sku_class where class_id = #{classId}")
    skuClass selectById(Long classId);
    @Insert("insert into tb_sku(brand_name,class_id,price,sku_image,sku_name,unit,create_time,updete_time) values(#{brandName},#{classId},#{price},#{skuImage},#{skuName},#{unit},#{createTime},#{updateTime})")
    Boolean insert(Merchandise merchandise);

    Boolean updateMerchand(@Param("skuIdmerchandise") Merchandise skuIdmerchandise,@Param("skuId") Long skuId);
    @Select("select * from tb_sku where sku_id = #{skuId}")
    Merchandise selectByskuId(Long skuId);
    @Select( "select count(sku_id)from tb_sku")
    Integer getTotal();
}
